import { Body, Controller, Post } from '@nestjs/common';
import { RoleManageService } from './roleManage.service';
import { CreateRoleDto } from './dto/create.dto';
import { UpdateRoleDto } from './dto/update.dto';
import { RoleManage } from './entities/roleManage.entity';
import { DeleteRoleDto } from './dto/delete.dto';
import { ListDto } from './dto/list.dto';

@Controller('role')
export class RoleManageController {
  constructor(private readonly RoleManageService: RoleManageService) {}

  @Post('create')
  async createRole(@Body() createRoleDto: CreateRoleDto) {
    return await this.RoleManageService.createRole(createRoleDto);
  }

  @Post('delete')
  async deleteRole(@Body() deleteRoleDto: DeleteRoleDto) {
    return await this.RoleManageService.deleteRole(deleteRoleDto);
  }

  @Post('update')
  async updateRole(@Body() updateRoleDto: UpdateRoleDto) {
    return await this.RoleManageService.updateRole(updateRoleDto);
  }

  @Post('detail')
  async getDetail(@Body() params: Partial<RoleManage>) {
    return await this.RoleManageService.getDetail(params);
  }

  @Post('list')
  async getMenuList(@Body() listDto: ListDto) {
    return await this.RoleManageService.getMenuList(listDto);
  }
}
